package com.wildeman.letras.android;

import com.wildeman.letras.android.R;
import com.wildeman.letras.model.Monosilabo;

import android.app.Activity;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.widget.TextView;
import android.widget.ViewSwitcher;

public class PrincipalActivity extends Activity 
{
	ViewSwitcher switcher;
	TextView txta, txtb;
	boolean primero = true;
	Monosilabo ms;
	
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) 
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        switcher = (ViewSwitcher) findViewById(R.id.viewSwitcher);
        
        ms = new Monosilabo();
        
        txta = (TextView) findViewById(R.id.textViewletrasA);
        txtb = (TextView) findViewById(R.id.textViewletrasB);
        
        primero = true;
        txta.setText(ms.generaMonosilabo());
        
        
        switcher.setOnTouchListener(new View.OnTouchListener() 
        {
			@Override
			public boolean onTouch(View v, MotionEvent event) 
			{
				if (primero)
				{
					txtb.setText(ms.generaMonosilabo());
					primero = false;
				}
				else
				{
					txta.setText(ms.generaMonosilabo());
					primero = true;
				}
				
				switcher.showNext();
				return false;
			}
		});
        
        
        
        
        
    }
}